home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 7_10.lha / 7_10 / p_pause.c < prev    next >
Text File  |  1993-08-08  |  1KB  |  37 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. include <process.h>
  6. include <debug.h>    /* DELETE */
  7. / Stop this process until rescheduled by something.
  8. / Make certain that the process_object alertobj wakes us up.
  9. oid process::pause(process_object *alertobj)
  10.  
  11.    if (debug) /*DELETE*/ cerr << "process" << this << "::pause(" << alertobj << ")\n";
  12.    if (mustrecurse())
  13. pause();
  14.  
  15.    else
  16. {
  17. if (alertobj)
  18.     alertobj->remember(this);
  19.  
  20. if ((this == t_thisprocess) ||
  21.     rmfromlist(this, &t_runprocesses) || 
  22.     rmfromlist(this, &t_waitprocesses))
  23.     {
  24.     t_next = t_waitprocesses;
  25.     t_waitprocesses = this;
  26.     t_curstate = TASK_IDLE;
  27.     }
  28. if (debug) /*DELETE*/ cerr << "\t" << this << "->t_curstate <- " << ps_print(t_curstate) << "\n";
  29.  
  30. // save and schedule another process
  31. if (this == t_thisprocess)
  32.     if (!contextswitch())
  33.         schedule();
  34. if (debug)  /*DELETE*/    cerr << "<<<< process" << this << "::pause(" << alertobj << ")\n";
  35. }
  36.  
  37.